package com.example.mybatisplusdemo.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.mybatisplusdemo.model.domain.Flight;
import com.example.mybatisplusdemo.model.domain.ItineraryRequest;
import com.example.mybatisplusdemo.model.dto.PriceComparisonDTO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;
import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author yzy
 * @since 2025-07-07
 */
public interface FlightMapper extends BaseMapper<Flight> {
    List<Flight> selectFlightsByItinerary(@Param("request") ItineraryRequest request);
    // 智能组合航班查询
    List<Flight> findSmartCombinations(
            @Param("origin") String origin,
            @Param("destination") String destination,
            @Param("startTime") LocalDateTime startTime,
            @Param("endTime") LocalDateTime endTime,
            @Param("serviceClass") String serviceClass,
            @Param("minPunctuality") Double minPunctuality,
            @Param("maxCarbon") Double maxCarbon,
            @Param("sort") String sort
    );

    // 供应商价格比较
    List<PriceComparisonDTO> comparePrices(@Param("flightId") Long flightId);
}